﻿<Window x:Class="CRUDGenerator.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="SQL CRUD Generator" Height="532" Width="584">
    <Grid >
        <Grid.Background>
            <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                <GradientStop Color="SlateBlue" Offset="0"></GradientStop>
                <GradientStop Color="Aquamarine" Offset="1.0"></GradientStop>
            </LinearGradientBrush>
        </Grid.Background>
        <Grid.RowDefinitions>
            <RowDefinition Height="32*" />
            <RowDefinition Height="104.92*" />
            <RowDefinition Height="28.085*" />
            <RowDefinition Height="74.13*" />
            <RowDefinition Height="81.386*" />
            <RowDefinition Height="31*" />
            <RowDefinition Height="109.366*" />
            <RowDefinition Height="33.11*" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="254*" />
            <ColumnDefinition Width="254*" />
        </Grid.ColumnDefinitions>
        <Label Margin="0,3,0,6" Name="lblFunctionName" HorizontalAlignment="Left" Width="96">Function Name:</Label>
        <TextBox Margin="92,5,25,0" Name="txtFunctionName" />
        <Label Margin="63,0,64,0" Name="lblAddParameterCode" Grid.Row="2">Additional Parameter Code</Label>
        <Label Margin="62,0,69,0" Name="lblAddExceptionCode" Grid.Column="1" Grid.Row="2">Additional Exception Code</Label>
        <TextBox Grid.Row="3" Margin="6" Name="txtAddParameterCode" VerticalScrollBarVisibility="Visible" AcceptsReturn="True" TextWrapping="Wrap" />
        <TextBox Margin="6" Name="txtAddExceptionCode" Grid.Row="3" Grid.Column="1" VerticalScrollBarVisibility="Visible" AcceptsReturn="True" TextWrapping="Wrap" />
        <CheckBox Grid.Row="4" Height="16" Margin="12,8,74,0" Name="chkPassConnection" VerticalAlignment="Top" ToolTip="Pass in Connection object in parameter">Pass in Connection object</CheckBox>
        <CheckBox Margin="12,30,74,29" Name="chkUseTransaction" Grid.Row="4" ToolTip="Use Transaction" Checked="chkUseTransaction_Checked">Use Transaction</CheckBox>
        <CheckBox Margin="12,42,74,7" Name="chkPassTransaction" Height="16" Grid.Row="4" ToolTip="Pass in Transaction object in parameter" IsEnabled="False">Pass in Transaction object</CheckBox>
        <CheckBox Margin="12,8,51,0" Name="chkUseSQLReader" Grid.Column="1" Height="16" Grid.Row="4" VerticalAlignment="Top" ToolTip="For Select SQL, use SQLReader">For Select SQL, use SQLReader</CheckBox>
        <CheckBox Margin="12,30,6,29" Name="chkReturnPrimaryKey" Grid.Column="1" Grid.Row="4" ToolTip="For Insert SQL, return the auto-increment primary key">For Insert SQL, return primary key</CheckBox>
        <ListBox Grid.Row="6" Margin="6" Name="listBoxSQPParameterType" >
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="{Binding Path=Name}" Width="80"/>
                        <ComboBox SelectedValue="{Binding Path=SQLType}" ItemsSource="{StaticResource ColorListString}"
                            DisplayMemberPath ="ValueString" 
                            SelectedValuePath="ValueString" Width="80" />
                        <TextBlock Text=", Length:" Width="50"/>
                        <TextBox Text="{Binding Path=TextLength}" Width="30"/>
                    </StackPanel>
                </DataTemplate>
            </ListBox.ItemTemplate>

        </ListBox>
        <Label Margin="61,0,64,3" Name="lblSQLParameterType" Height="28" Grid.Row="5" VerticalAlignment="Bottom">Parameter SQL Type</Label>
        <Label Margin="92,0,91,4.96" Name="lblGenerateCode" Grid.Column="1" Grid.Row="5">Generated Code</Label>
        <CheckBox Grid.Column="1" Grid.Row="7" HorizontalAlignment="Left" Margin="6,6,0,0" Name="chkCopyClipboard" Width="120" Height="16.295" VerticalAlignment="Top" IsChecked="True">Copy To Clipboard</CheckBox>
        <Button Grid.Column="1" Grid.Row="7" HorizontalAlignment="Right" Margin="0,0,6,6" Name="btnGenerateCode" Width="112" Click="btnGenerateCode_Click" IsEnabled="False">Generate Code</Button>
        <TextBox Grid.Row="1" Margin="6,6,91,9" Name="txtSQL" Grid.ColumnSpan="2" TextWrapping="Wrap" AcceptsReturn="True" VerticalScrollBarVisibility="Visible" />
        <Button Grid.Column="1" Grid.Row="1" HorizontalAlignment="Right" Margin="0,0,10,8.998" Name="btnParse" Width="75" ToolTip="Parse for @ Parameters" Height="22.92" VerticalAlignment="Bottom" Click="btnParse_Click">Parse</Button>
        <TextBox Margin="6" Name="txtGeneratedCode" Grid.Column="1" Grid.Row="6" VerticalScrollBarVisibility="Visible" AcceptsReturn="True" TextWrapping="Wrap" />
    </Grid>
</Window>
